package com.qfedu.springmvc02.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.qfedu.springmvc02.utils.SalarySerialize;
import lombok.Data;

import java.util.Date;

@Data
public class FastUser {

    //SerializerFeature.WriteMapNullValue 序列null值的属性
    //SerializerFeature.WriteNullStringAsEmpty  把null转换为  ""
    @JSONField(serialzeFeatures = {SerializerFeature.WriteMapNullValue,SerializerFeature.WriteNullStringAsEmpty})
    private String id;
    @JSONField(name = "username")
    private String name;

    //serialize = false  序列化时忽略这个属性
    @JSONField(serialize = false)
    private String password;
    private Date birthday;
    @JSONField(serializeUsing = SalarySerialize.class)
    private double salary;

    //format  指定日期格式
    @JSONField(format = "yyyy-MM-dd")
    private Date marriageDay;
}
